<template>
	<view class="container">
		<u-navbar title="活动"
			background="url('https://www.yplm888.com//uploads/20220803/7ed305f9a93ba50b049a7725662b18cc.png') no-repeat">
		</u-navbar>
		<view class="topView" id='topView' ref="topView">
			<view class="topVideoCon">
				<view class="cover">
					<image class="cover-image" :src="videoInfo.bigimage" mode="scaleToFill"></image>
				</view>
			</view>
			<view class="detail">
				<text class="name">{{videoInfo.name||''}}</text>
				<view class="price">
					 <text class="orgPrice">{{videoInfo.money||''}}</text>
				</view>
				<!-- <view class="secend-line">
					<u-icon class='icon' name="eye"></u-icon><text
						style="margin-right: 20rpx;">{{videoInfo.reading_volume}}</text>
					<u-icon class='icon' name="calendar"></u-icon>
					<text>{{$u.timeFormat(videoInfo.createtime, 'yyyy-mm-dd hh:MM:ss')}}</text>
					<text style="margin-left: 40rpx;">
						兑换人次：{{videoInfo.sales_volume}}
					</text>
				</view> -->
			</view>
		</view>
		<scroll-view :scroll-y="true" :style="'height:' + scrollH+'rpx;'">
			<view style="font-size: 36rpx; font-weight: 700; text-align: center;">详情</view>
			<view class="content-text">
				<!-- <view class="font-style-xie">大纲</view> -->
				<u-parse :html="videoInfo.outline_content"></u-parse>
				<!-- <view class="font-style-xie">详情</view> -->
				<!-- <u-parse :html="videoInfo.content"></u-parse> -->
			</view>
		</scroll-view>
		<view class="page-bottom">
			<view :class="videoInfo.have?'have':'buy'"  @click="tokefu">
				<u-icon name="server-fill" color='#FE5477' size="40"></u-icon>立即领取
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				videoInfo:{}
			}
		},
		onLoad() {
			this.initData()
		},
		methods: {
			// 客服
			async tokefu() {
				await this.getConfig()
				let res = await this.$u.api.activityService()
				// console.log(res.data)
				this.toChat(res.data)
			},
			getConfig() {
				this.$u.api.getChatConfig().then(res => {
					this.config = res.data.corpId
				})
			},
			toChat(data) {
				try {
					wx.openCustomerServiceChat({
						extInfo: {
							url: data.url //客服ID
						},
						corpId: this.config, //企业微信ID
						success(res) {}
					})
				} catch (error) {}
			},
			initData() {
				this.$u.api.getActivity().then(res => {
					// console.log(res)
					// this.isCollect = res.data.is_collection == 1 ? true : false
					this.videoInfo = res.data
					// console.log(this.videoInfo)
					// this.changMedia(res.data.curriculum[0], 0)
				})
			},
		}
	}
</script>


<style lang="scss">
	.topVideoCon {
		position: relative;
		width: 100%;
		height: 400rpx;
		.video-wrap,
		.cover {
			width: 100%;
			position: absolute;
			top: 0;
			left: 0;
		}
		.video-wrap {
			z-index: 11;
		}
		.cover {
			z-index: 99;
		}
		
	}
	
	.container {
		overflow-x: hidden;
		position: relative;

		.audio-view {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 30rpx 50rpx 0rpx 50rpx;
			background-color: #FFFFFF;
		}

		.play-time-area {
			display: flex;
			align-items: center;
			flex-direction: row;
		}

		.audio-time {
			width: 150rpx;
			line-height: 100rpx;
		}

		.duration {
			margin-left: auto;
		}

		.audio-siler {
			width: 200%;
		}

		.play-silder {
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: space-around;
		}

		.play-button-area {
			display: flex;
			flex-direction: row;
			justify-content: center;
			width: 100rpx;
		}

		.icon-play {
			width: 100rpx;
			height: 100rpx;
		}

		.page-bottom {
			position: fixed;
			bottom: 0;
			width: 100%;
			height: 120rpx;
			background-color: #fff;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 30rpx;
			border-top: 1rpx solid rgba(0, 0, 0, 0.1);

			.icon-text {
				width: 70rpx;
				text-align: center;

				.text {
					font-size: 15rpx;
					color: #ccc;
					margin-top: -10rpx;
				}
			}

			.buy {
				background-color: #FE5477;
				height: 80rpx;
				width: 500rpx;
				border-radius: 40rpx;
				color: #fff;
				text-align: center;
				line-height: 80rpx;
				margin: auto;
			}

			.have {
				background: #f6f6f6;
				height: 80rpx;
				width: 500rpx;
				border-radius: 40rpx;
				color: #ccc;
				text-align: center;
				line-height: 80rpx;
			}
		}
	}

	.topView {
		background-color: #FFFFFF;
		width: 100%;

		.video-wrap {
			text-align: center;
			width: 100%;
			height: 400rpx;
			background-color: #000000;
		}

		.cover {
			.cover-image {
				width: 100%;
				height: 410rpx;
				z-index: 66;
				position: absolute;
				right: 0;
			}
		}


		.detail {
			padding: 0 20rpx;
			margin: 0 20rpx;
			margin-top: 10rpx;
			min-height: 200rpx;
			width: 100%;
			border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
			position: relative;

			.name {
				font-size: 36rpx;
				font-weight: 700;
			}

			.price {
				font-size: 36rpx;
				font-weight: 700;
				color: #FE5477;

				.orgPrice {
					font-size: 26rpx;
					font-weight: 400;
				}
			}

			.secend-line {
				color: #ccc;
				margin-top: 20rpx;

				.icon {
					margin-left: 10rpx;
				}

			}
		}

	}


	.class-list {
		margin: 30rpx;
		padding: 10rpx;
		font-size: 28rpx;
		background: #f9f9f9;
		border-radius: 20rpx;

		u-icon {
			margin-right: 20rpx;
		}

		.media {
			margin: 10rpx;
			min-height: 60rpx;
			border-bottom: 1rpx solid #CCC;
			display: flex;
			padding: 10rpx;

			.study-order {
				font-size: 20rpx;
				color: #FE5477;
			}
		}

		.play {
			background: #e6effb;
			color: #3d91d6;
			border-radius: 30rpx;
		}
	}

	.content-text {
		margin: 40rpx;
		margin-top: 0rpx;
		padding-bottom: 120rpx;
	}

	.font-style-xie {
		font-weight: 700;
		font-size: 32rpx !important;
		font-style: italic;

		.video-num {
			font-style: normal;
			font-weight: normal;
			font-size: 16rpx;
			color: #FE5477;
			float: right;
			margin-right: 10rpx;
			margin-top: 10rpx;
		}
	}

	.model {
		margin-top: 40rpx;
		padding: 0 40rpx;

		.scroll-view_H {
			margin-top: 20rpx;
			white-space: nowrap;
			width: 100%;

			.show-item {
				display: inline-block;

				.image {
					height: 200rpx;
					width: 300rpx;
					border-radius: 20rpx;
					margin-right: 20rpx;
					background-color: #ccc;
				}
			}
		}


	}
</style>
